<template>
  <div class="app-wrap">
    <!-- 一级路由出口 -->
    <!-- <keep-alive>
      <router-view></router-view>
    </keep-alive> -->
    <router-view></router-view>
  </div>
</template>

<script>
import { api_goods_list } from "@/apis/goods";
import { mapMutations } from "vuex";
export default {
  created() {
    console.log("app-created");
    this.getGoodsList();
  },
  destroyed() {
    console.log("app-destroyed");
  },
  methods: {
    ...mapMutations(["SET_GOODS_LIST"]),
    async getGoodsList() {
      const res = await api_goods_list();
      // console.log(res);
      if (res.data.code === 0) {
        // 去修改state中的goodsList
        this.SET_GOODS_LIST(res.data.data);

        // this.goodsList = res.data.data;
      }
    },
  },
};
</script>

<style lang="less" scoped>
.app-wrap {
  height: 100%;
}
</style>